/*
   \file  exceptions.cc
   \brief Some common exception classes.

   This file implements the non-inline member functions of the classes
   defined in its header file. See that for more details.
*/

/*
   This file is part of libgist.

   libgist is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   libgist is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with libgist; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

/*
   REVISION HISTORY

   $HeadURL: http://libgist.googlecode.com/svn/branches/wu_dev/drv/exceptions.cc $
   $Id: exceptions.cc 41 2011-08-22 08:51:48Z libgist@gmail.com $
*/

//------------------------------ HEADERS --------------------------------

// gistdrv
#include "exceptions.hh"

//----------------------- NAMESPACE DEFINITION --------------------------

namespace gistdrv {

//----------------- EXCEPTION CLASSES INITIALIZATION --------------------

// Base class
exception::exception(int error_code, const std::string& error_msg)
   : runtime_error(error_msg), m_code(error_code)
{}

// User-specified action unsupported by requested libgist algorithm
unknown_action::unknown_action(int error_code,
                               const std::string& algo_name,
                               const std::string& action)
   : exception(error_code,
               algo_name + ": " + action + ": no such action; try " +
               algo_name + " help")
{}

// Unable to open a file for writing
unable_to_create_file::
unable_to_create_file(int error_code, const std::string& file_name)
   : exception(error_code, file_name + ": could not open file for writing")
{}

//-----------------------------------------------------------------------

} // end of namespace encapsulating this file's definitions

/* So things look consistent in everyone's emacs... */
/* Local Variables: */
/* indent-tabs-mode: nil */
/* End: */
